Find the location of python module sourcesΒΆ

Find the location of python module sources.
import sys

print("\nList of directories in sys module:")
print(sys.path)
print("\nList of directories in os module:")

import os
print(os.path)

Output:

List of directories in sys module:
['/home/students',
 '/usr/lib/python37.zip',
 '/usr/lib/python3.7',
 '/usr/lib/python3.7/plat-x86_64-linux-gnu',
 '/usr/lib/python3.7/lib-dynload',
 '/usr/local/lib/python3.7/dist-packages',
 '/usr/lib/python3/dist-packages']

List of directories in os module:
<module 'posixpath' from '/usr/lib/python3.7/posixpath.py'>